<html>
		<head>
			<link rel="stylesheet" href="style.css">
			<script
				src="https://maps.googleapis.com/maps/api/js?sensor=false">
			</script>


	
		</head>
	<body>


	
		<table  id="contentTable">
			<tr>
				<td colspan="2" id="pageheader">
					HEALTH INFORMATION SYSTEMS
				</td>
			</tr>
			<tr>
				<td id="mainnav">
					<div class="menuitem"><a href="Home.php">location</a></div>
					<div class="menuitem">opd cases</div>
					<div class="menuitem">health promotion</div>
					<div class="menuitem">nutrition</div>
					<div class="menuitem">child welfare</div>
					<div class="menuitem">family planning</div>
					<div class="menuitem"><a href="userslist.php">users</a></div>
					<div class="menuitem"><a href="logout.php">logout<a></div>
				</td>
				<td id="content">
					<div id="divPageMenu">
						<span class="menuitem" >Community Health Officer</span> | 
						<span class="menuitem" >Districts</span> | 
						<span class="menuitem" ><a href="subdistrict_list.php">Sub districts</a></span> | 
						<span class="menuitem" ><a href="community_lists.php">Communities<a/></span>
					</div>
					<div id="divContent">
					<div id = 'addNew'><span class='hotspot' ><a href = "community_add.php" target="_blank">Add to the community table</a></span></div>
						<table class="reportTable" width="100%">
							<tr class="header" >
								<td>community Details</td>
								<td></td>
							</tr>
							
							
		<?php	
	
	
	$id=$_REQUEST["community_id"];

	include("community.php");
	$obj = new community();
	if(!$obj -> get_community_id($id)){
		echo"error";
		echo mysql_error($obj->link);
		exit();
	}


	$row = $obj->fetch();
	
	$row_counter = 0;
	
		while($row){
			echo "<table>";	
	
		if($row_counter%2==0){
			$style=" class='row1' ";
		}else{
			$style=" class='row2'  ";
		}
		
	
		
		echo "<tr $style >";
		echo "<tr>";
		echo "<td> Community ID:</td>";
		echo "<td>" . $row["community_id"]  ."</td>";
		echo "</tr>";
		
		echo "<tr>";
		echo "<td>Community Name:</td>";
		echo"<td>". $row["community_name"] . "</td>";
		echo "</tr>";
		
		echo "<tr>";
		echo "<td> longitude:</td>";
		echo"<td>". $row["longitude"] ."</td>";
		echo "</tr>";
		echo "<input type='hidden' value =".$row['longitude']." id='longitude' ></input>";
		
		echo "<tr>";
		echo "<td> Latitude:</td>";
		echo "<td>". $row["latitude"]  ."</td>";	
		echo "</tr>";
		echo "<input type='hidden' value =".$row['latitude']." id='latitude' ></input>";
		
		echo "<tr>";
		echo "<td> Population:</td>";
		echo "<td>". $row["population"]  ."</td>";
		echo "</tr>";
		
		echo "<tr>";
		echo "<td> Household:</td>";
		echo"<td>".	$row["household"]  ."</td>";
		echo "</tr>";
		
		echo "<tr>";
		echo "<td> Subdistrict_id:</td>";
		echo "<td>". $row["subdistrict_id"]  ."</td>";
		echo "</tr>";
		
		echo "</tr>";
	
	
	
	
		$row = $obj->fetch();
	
	echo"</table>";
	}
?>
	
	<div id = "googleMap" style = "width:500px;height:380px;"></div>
	
	</body>
			<script>
					//var a = <?php  echo '$longitudes' ?>;
					//var b = <?php echo '$latitude' ?>;
					var a = document.getElementById('longitude').value;
					var b = document.getElementById('latitude').value;
				
				function initialize(){
					var mapProp = {
			  		center:new google.maps.LatLng(a,b),
			  		zoom:5,
			  		mapTypeId:google.maps.MapTypeId.ROADMAP
			  		};
					var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
				}

					google.maps.event.addDomListener(window, 'load', initialize);
			</script>

</html>